package com.meilai.project.config;


/**
 * @author 张驰
 * @date 2020/11/3 10:26
 */
//@AllArgsConstructor
//@Configuration
//@ConditionalOnClass(WxMpService.class)
//@EnableConfigurationProperties(WxMpProperties.class)
public class WxMpConfiguration {
//    private final WxMpProperties properties;
//
//    @Bean
//    @ConditionalOnMissingBean
//    public WxMpService wxMpService() {
//        final List<WxMpProperties.MpConfig> configs = this.properties.getConfigs();
//        if (configs == null) {
//            throw new RuntimeException("未找到对应配置！");
//        }
//
//        WxMpService service = new WxMpServiceImpl();
//        service.setMultiConfigStorages(configs
//                .stream().map(a -> {
//                    WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl();
//                    configStorage.setAppId(a.getAppId());
//                    configStorage.setSecret(a.getSecret());
//                    configStorage.setToken(a.getToken());
//                    configStorage.setAesKey(a.getAesKey());
//                    return configStorage;
//                }).collect(Collectors.toMap(WxMpDefaultConfigImpl::getAppId, a -> a, (o, n) -> o)));
//        return service;
//    }

}
